feat: ZstdDictionaryId value type + ZSTD_getDictID_fromDict#29
Merged
Conversation
Adds Zstd.dictId(byte[]) / Zstd.dictId(MemorySegment), the core-libzstd reader for the dictionary id stamped in raw dictionary bytes — the counterpart to ZstdFrame.dictId (which reads a frame) and the no-wrapper alternative to ZstdDictionary.id() (which uses the equivalent ZDICT reader). Binds ZSTD_getDictID_fromDict. Introduces ZstdDictionaryId, a record wrapping the 32-bit id with an unsigned value(), isPresent(), and a NONE sentinel for "no id" (0). Every dictionary-id accessor now returns it instead of int: ZstdDictionary.id(), ZstdCompressDict.id(), ZstdDecompressDict.id(), ZstdFrame.dictId(...), and the ZstdFrameHeader.dictId() component. This makes the unsigned semantics and the 0-means-absent sentinel explicit at every call site. docs/supported.md: ZSTD_getDictID_fromDict now bound (Dictionary 10 -> 11/23). CHANGELOG Unreleased updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ZSTD_getDictID_fromDictasZstd.dictId(byte[])/Zstd.dictId(MemorySegment)— reads the dictionary id stamped in raw dictionary bytes via the core libzstd reader, without wrapping them in aZstdDictionary.ZstdDictionaryId, arecordwrapping the 32-bit id with an unsignedvalue(),isPresent(), and aNONEsentinel for "no id".Why a value type
zstd's dict id is a C
unsigned(can exceedInteger.MAX_VALUE) and0is the magic "no dictionary" sentinel. Aninthid both facts.ZstdDictionaryIdmakes the unsigned read (value()) and the absent case (NONE/isPresent()) explicit.Scope — the whole id family
Every dictionary-id accessor now returns
ZstdDictionaryIdinstead ofint:ZstdDictionary.id(),ZstdCompressDict.id(),ZstdDecompressDict.id(),ZstdFrame.dictId(...), and theZstdFrameHeader.dictId()component.Tests
ZstdDictionaryIdTest(value type: unsigned widening, NONE, equality) +ZstdTest.DictIdLookup(reads stamped id, NONE for non-dict/short input, segment parity, heap rejection, agrees withZstdDictionary.id()). 212 unit + 81 integration green, javadoc + checkstyle clean.Notes
docs/supported.md:ZSTD_getDictID_fromDictnow bound (Dictionary 10 → 11/23).CHANGELOG.mdUnreleased updated.🤖 Generated with Claude Code